/*! \file
 * \brief Enter a brief description here.
 *
 * Enter a detailed description here. (optional)
 * \author Author (Ivo Wingelaar)
 * \date Date (2011)
 * \version Version (0.0.1)
 * \copyright Copyright (GNU LGPL v3)
 */

#ifndef __LYNX_LOG_MANAGER_C_HPP_INCLUDED__
#define __LYNX_LOG_MANAGER_C_HPP_INCLUDED__

#include "LynxLogManager.hpp"
#include "LynxEventReceiver.hpp"

namespace Lynx
{

/** class        **/
/** LogManager_C **/
//! An implementation of the LogManager
class LogManager_C : public LogManager
{
public:
    /** constructor **/
    /// \param    LYNX_E_LOG_LEVEL level
    ///         The desired log-level of the logmanager.
    LogManager_C(LYNX_E_LOG_LEVEL level);

    /** default destructor **/
    virtual ~LogManager_C();

    /** const virtual function **/
    /** get_log_level          **/
    //! Returns the logging level.
    /// \return LYNX_E_LOG_LEVEL
    ///         The logging level.
    /// \param  void
    virtual LYNX_E_LOG_LEVEL get_log_level(void) const;

    /** virtual function **/
    /** set_log_level    **/
    //! Sets the logging level.
    /// \return void
    /// \param    LYNX_E_LOG_LEVEL level
    ///         The new level you want to set.
    virtual void set_log_level(LYNX_E_LOG_LEVEL level);

    /** virtual function   **/
    /** set_event_receiver **/
    //! Sets the eventreceiver to send the events to.
    /// \return void
    /// \param    EventReceiver *receiver
    ///         A pointer to the desired eventreceiver.
    virtual void set_event_receiver(EventReceiver* receiver);

    /** virtual function **/
    /** log              **/
    //! Logs something.
    /// \return void
    /// \param    const char* text
    ///         The text you want to log.
    /// \param    LYNX_E_LOG_LEVEL level
    ///         The level of the message.
    virtual void log(const char* text,
                     LYNX_E_LOG_LEVEL level = ELL_INFORMATION);

    /** virtual function **/
    /** log              **/
    //! Logs something.
    /// \return void
    /// \param    const char* text
    ///         The text you want to log.
    /// \param    const char* hint
    ///         The hint you want to append to the text.
    /// \param    LYNX_E_LOG_LEVEL level
    ///         The level of the message.
    virtual void log(const char* text,
                     const char* hint,
                     LYNX_E_LOG_LEVEL level = ELL_INFORMATION);

    /** virtual function **/
    /** log              **/
    //! Logs something.
    /// \return void
    /// \param    const wchar_t* text
    ///         The text you want to log.
    /// \param    LYNX_E_LOG_LEVEL level
    ///         The level of the message.
    virtual void log(const wchar_t* text,
                     LYNX_E_LOG_LEVEL level = ELL_INFORMATION);

    /** virtual function **/
    /** log              **/
    //! Logs something.
    /// \return void
    /// \param    const wchar_t* text
    ///         The text you want to log.
    /// \param    const wchar_t* hint
    ///         The hint you want to append to the text.
    /// \param    LYNX_E_LOG_LEVEL level
    ///         The level of the message.
    virtual void log(const wchar_t* text,
                     const wchar_t* hint,
                     LYNX_E_LOG_LEVEL level = ELL_INFORMATION);

    /** const virtual function **/
    /** get_output_count       **/
    //! Returns the total amount of outputs.
    /// \return uint32_t
    ///         The total amount of outputs.
    /// \param  void
    virtual uint32_t get_output_count(void) const;

    /** virtual function **/
    /** remove_output    **/
    //! Removes an output.
    /// \return void
    /// \param    uint32_t index
    ///         The index of the output to remove.
    virtual void remove_output(uint32_t index);

    /** virtual function **/
    /** add_output      **/
    //! Adds an output.
    /// \return void
    /// \param    LogOutput* output
    ///         A pointer to a logoutput to add.
    virtual void add_output(LogOutput* output);

private:
    //! The eventreceiver to send the event to.
    EventReceiver* mReceiver;
    //! The current logging level.
    LYNX_E_LOG_LEVEL mLevel;
    //! All the outputs for the logmanager.
    std::vector<LogOutput*> mOutputs;
};

/** class              **/
/** LogOutputConsole_C **/
//! An ouput that outputs to the console.
class LogOutputConsole_C : public LogOutput
{
public:
    /** default constructor **/
    LogOutputConsole_C();

    /** default destructor **/
    virtual ~LogOutputConsole_C();

    /** virtual function **/
    /** print            **/
    //! Prints text somewhere, depends on implementation.
    /// \return void
    /// \param    const char *text
    ///         The text you want to print/display somewhere.
    virtual void print(const char* text);
};

} // namespace Lynx

#endif // __LYNX_LOG_MANAGER_C_HPP_INCLUDED__

